#include <stdio.h>
#include <stdlib.h>

struct student{
	
	int num;
	char name[10];
	int com,math,english;
	double ave;
};

int main(){
	
	int i,n;
	struct student s[10],*max;
	
	printf("Enter n:");
	scanf("%d",&n);
	max=s;
	
	for(i=0;i<n;i++){
		printf("Input %d student:",i+1);
		scanf("%d%s%d%d%d",&s[i].num,s[i].name,&s[i].com,&s[i].english,&s[i].math);
		s[i].ave=(s[i].com+s[i].english+s[i].math)/3.0;
		
		if(max->ave<s[i].ave)
		  max=s+i;
	}
	
	printf("%d %s %.2lf",max->num,max->name,max->ave);
	
	return 0;
}
